import com.spring.Service.StudentService;
import com.spring.Service.UserService;
import com.spring.demo.controller.StudentController2;
import com.spring.demo.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        //1.得到 Spring 容器
        ApplicationContext context = new
                ClassPathXmlApplicationContext("spring-config.xml");
        User user = context.getBean("user222", User.class);
        System.out.println(user.getPassword());
        System.out.println(user.getUsername());

        //2.得到Bean 对象
//        StudentController2 studentController =
//                context.getBean("studentController2", StudentController2.class);
//        //3.使用 Bean 对象
//        studentController.sayHi();
//        //
//        UserService userService =
//                context.getBean("userService", UserService.class);
//        userService.sayHi();
//
//        StudentService studentService =
//                context.getBean("studentService", StudentService.class);
//        studentService.sayHi();
    }
}
